From: Owen W. Taylor Date: Tue, 23 Feb 2010 00:21:42 +0000 (-0500) Subject: Convert the check-for-missing files check to a python script X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~10405 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=e7066d12cf89001b172cab04bde5e61c46e7c94b;p=gnome-shell.git Convert the check-for-missing files check to a python script 'git ls-files --exclude=' was changed (intentionally!) not to exclude anything files that are actually in the index. Since git ls-files by default simply lists the files in the index, this is a problem. Emulating this in shell went past the limits of what made sense, so move it to a simple external python script. --- diff --git a/Makefile.am b/Makefile.am index 8957f9c1a..cc3c02d31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,8 @@ SUBDIRS = data js src tests po man EXTRA_DIST = \ .project \ .settings \ - autogen.sh + autogen.sh \ + tools/check-for-missing.py # These are files checked into Git that we don't want to distribute DIST_EXCLUDE = \ @@ -17,14 +18,4 @@ DIST_EXCLUDE = \ distcheck-hook: @echo "Checking disted files against files in git" - @failed=false; \ - exclude=`(for p in $(DIST_EXCLUDE) ; do echo --exclude=$$p ; done)`; \ - for f in `cd $(srcdir) && git ls-files $$exclude` ; do \ - if ! test -e $(distdir)/$$f ; then \ - echo File missing from distribution: $$f ; \ - failed=true ; \ - fi \ - done ; \ - if $$failed ; then \ - exit 1 ; \ - fi + @$(srcdir)/tools/check-for-missing.py $(srcdir) $(distdir) $(DIST_EXCLUDE) diff --git a/tools/check-for-missing.py b/tools/check-for-missing.py new file mode 100755 index 000000000..0a689d7ff --- /dev/null +++ b/tools/check-for-missing.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +# +# This is a simple script that we use to check for files in git +# and not in the distribution. It was previously written in shell +# and inlined in the Makefile.am, but 'git ls-files --exclude=' +# was changed to no longer due anything useful, which made that +# too challenging to be worthwhile. + +import fnmatch, os, subprocess, sys + +srcdir=sys.argv[1] +distdir=sys.argv[2] +excludes=sys.argv[3:] + +os.chdir(srcdir) + +status=0 +for f in subprocess.Popen(["git", "ls-files"], stdout=subprocess.PIPE).stdout: + f = f.strip() + if (not os.path.exists(os.path.join(distdir, f)) and + not any((fnmatch.fnmatch(f, p) for p in excludes))): + print "File missing from distribution:", f + status=1 + +sys.exit(status)